<%@ Control Language="VB" AutoEventWireup="false" codefile="ShoppingCart.ascx.vb" Inherits="ShoppingCartControl" %>

<%@ import Namespace="Wrox.Commerce" %>

    <!--
    This grid isn't bound using a data source control, so we
    have to provide the two way binding ourselves, by handling the events
    -->
    <asp:GridView ID="CartGrid" Runat="server" AutoGenerateColumns="False" DataKeyNames="ProductID"
        OnRowEditing="CartGrid_RowEditing" OnRowUpdating="CartGrid_RowUpdating"
        OnRowDeleting="CartGrid_RowDeleting" OnRowCancelingEdit="CartGrid_RowCancelingEdit">
        <Columns>
            <asp:TemplateField>
                <ItemTemplate>
                    <asp:Image id="ProductImage" Runat="server" ImageUrl='<%# Eval("ProductImageURL", "~/ProductImages/thumb_{0}")%>' />
                </ItemTemplate>
            </asp:TemplateField>
            <asp:BoundField DataField="ProductName" HeaderText="Product" ReadOnly="True" />
            <asp:BoundField DataField="Quantity" HeaderText="Quantity" />
            <asp:BoundField DataField="Price" HeaderText="Price" DataFormatString="{0:c}" ReadOnly="True" />
            <asp:BoundField DataField="LineTotal" HeaderText="Total" DataFormatString="{0:c}" ReadOnly="True" />
            <asp:CommandField ShowEditButton="True" ShowDeleteButton="true"></asp:CommandField>
        </Columns>
        <EmptyDataTemplate>
            There is nothing in your shopping cart. You can buy items from the 
            <a href="shop.aspx">Shop</a>.
        </EmptyDataTemplate>
    </asp:GridView>

    <br />

    <asp:Panel ID="DiscountPanel" Runat="server" Visible="false">
        <asp:Label ID="SubTotalLabel" runat="server" /><br />
        <asp:Label ID="MemberDiscount" Runat="server" />
    </asp:Panel>
    <br />
    <asp:Label ID="TotalLabel" Runat="server" />
